package test1014;

import java.util.Scanner;

public class Animal {
    private String name;
    private int age;

    public Animal() {
        this.name = name;
        this.age = age;

    }
        public void animalIdea () {
            System.out.print("我叫：" + name);
            System.out.println(" 今年：" + age + "岁");
        }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 通过循环逐个输入名字
        for (int i = 0; i < 5; i++)
        {
            Animal animal = new Animal();
            System.out.println("请输入第 " + (i + 1) + " 个动物的名字：");
            animal.name = scanner.nextLine();
            System.out.println("请输入第 " + (i + 1) + " 个动物的年龄：");
            animal.age = Integer.parseInt(scanner.nextLine());
            animal.animalIdea();
        }
    }

}
